package com.ruoyi.bizsys.controller;

import java.util.List;

import com.ruoyi.bizsys.domain.LoanOrderErrorLog;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.bizsys.service.ILoanOrderErrorLogService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 提现异常Controller
 *
 * @author african-loan
 * @date 2021-12-30
 */
@RestController
@RequestMapping("/bizsys/loan_order_error_log")
public class LoanOrderErrorLogController extends BaseController {
    @Autowired
    private ILoanOrderErrorLogService loanOrderErrorLogService;

/**
 * 查询提现异常列表
 */
@PreAuthorize("@ss.hasPermi('bizsys:loanerrlog:list')")
@GetMapping("/list")
        public TableDataInfo list(LoanOrderErrorLog loanOrderErrorLog) {
        startPage();
        List<LoanOrderErrorLog> list = loanOrderErrorLogService.selectLoanOrderErrorLogList(loanOrderErrorLog);
        return getDataTable(list);
    }
    
    /**
     * 导出提现异常列表
     */
    @PreAuthorize("@ss.hasPermi('bizsys:loanerrlog:export')")
    @Log(title = "提现异常", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(LoanOrderErrorLog loanOrderErrorLog) {
        List<LoanOrderErrorLog> list = loanOrderErrorLogService.selectLoanOrderErrorLogList(loanOrderErrorLog);
        ExcelUtil<LoanOrderErrorLog> util = new ExcelUtil<LoanOrderErrorLog>(LoanOrderErrorLog.class);
        return util.exportExcel(list, "log");
    }

    /**
     * 获取提现异常详细信息
     */
    @PreAuthorize("@ss.hasPermi('bizsys:loanerrlog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(loanOrderErrorLogService.selectLoanOrderErrorLogById(id));
    }

    /**
     * 新增提现异常
     */
    @PreAuthorize("@ss.hasPermi('bizsys:loanerrlog:add')")
    @Log(title = "提现异常", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LoanOrderErrorLog loanOrderErrorLog) {
        return toAjax(loanOrderErrorLogService.insertLoanOrderErrorLog(loanOrderErrorLog));
    }

    /**
     * 修改提现异常
     */
    @PreAuthorize("@ss.hasPermi('bizsys:loanerrlog:edit')")
    @Log(title = "提现异常", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LoanOrderErrorLog loanOrderErrorLog) {
        return toAjax(loanOrderErrorLogService.updateLoanOrderErrorLog(loanOrderErrorLog));
    }

    /**
     * 删除提现异常
     */
    @PreAuthorize("@ss.hasPermi('bizsys:loanerrlog:remove')")
    @Log(title = "提现异常", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(loanOrderErrorLogService.deleteLoanOrderErrorLogByIds(ids));
    }
}
